<?php if(!defined('IN_UCHOME')) exit('Access Denied'); ?><?php if(empty($_SGLOBAL['inajax'])) { ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=<?=$_SC['charset']?>" />
<title><?php if($_TPL['titles']) { ?><?php if(is_array($_TPL['titles'])) { foreach($_TPL['titles'] as $value) { ?><?php if($value) { ?><?=$value?> - <?php } ?><?php } } ?><?php } ?><?php if($space) { ?><?=$space['username']?> - <?php } ?><?=$_SCONFIG['sitename']?> - Powered by UCenter Home</title>
<script language="javascript" type="text/javascript" src="source/script_common.js"></script>
<script language="javascript" type="text/javascript" src="source/script_menu.js"></script>
<script language="javascript" type="text/javascript" src="source/script_ajax.js"></script>
<style type="text/css">
@import url(template/<?=$_SC['template']?>/common.css);
<?php if(!empty($space['theme'])) { ?>
@import url(theme/<?=$space['theme']?>/style.css);
<?php } ?>
<?php if(!empty($space['css'])) { ?>
<?=$space['css']?>
<?php } ?>
</style>
<?php if($space['uid']) { ?>
<link rel="alternate" type="application/rss+xml" href="rss.php?uid=<?=$space['uid']?>" title="<?=$space['username']?>" />
<?php } ?>
<link rel="edituri" type="application/rsd+xml" title="rsd" href="xmlrpc.php?rsd=1" />
</head>
<body>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div id="wrap">
<div id="header">
<h2><a href="index.php"><img src="<?=$_SCONFIG['sitelogo']?>" alt="<?=$_SCONFIG['sitename']?>" /></a></h2>
<?php if($_SGLOBAL['supe_uid']) { ?>
<ul id="menu">
<li><a href="space.php?do=home">首页</a><?php if($space['self'] && $space['credit']<10) { ?><a href="space.php?do=home&view=guide" class="edit">向导</a><?php } ?></li>
<li><a href="space.php">个人主页</a></li>
<li><a href="space.php?do=friend">好友</a><a href="javascript:;" onclick="openSub(this,'friend');" class="drop">&nbsp;</a></li>
<li><a href="network.php">随便看看</a><?php if(empty($_SCONFIG['showall'])) { ?><a href="space.php?do=home&view=all" class="edit">近况</a><?php } ?></li>
<li><a href="space.php?do=pm"><span id="span_newpm">私信</span><?php if(!empty($_SGLOBAL['member']['newpm'])) { ?><script>newpm();</script><?php } ?></a><a href="javascript:;" onclick="openSub(this,'pm');" class="drop">&nbsp;</a></li>
</ul>
<div id="op">
<a href="cp.php">设置</a><span class="pipe">|</span>
<a href="cp.php?ac=privacy">策略</a><span class="pipe">|</span>
<?php if($space['self'] && $space['credit']>=10) { ?><a href="space.php?do=home&view=guide">向导</a><span class="pipe">|</span><?php } ?>
<a href="cp.php?ac=common&op=logout">退出</a>
</div>
<?php } else { ?>
<div id="op">
<a href="index.php">首页</a><span class="pipe">|</span>
<a href="space.php">我的空间</a><span class="pipe">|</span>
<a href="help.php">帮助</a>
</div>
<?php } ?>
</div>
<div id="submenu">
<div id="subfriend" class="submenu">
<ul>
<li><a href="space.php?do=friend">好友列表</a></li>
<li><a href="space.php?do=friend&view=visitor">我的访客</a></li>
<li><a href="space.php?do=friend&view=trace">我的足迹</a></li>
<li><a href="space.php?do=friend&view=online">在线用户</a></li>
<li class="line"><a href="cp.php?ac=friend&op=find">寻找好友</a></li>
<li><a href="cp.php?ac=invite">邀请好友</a></li>
</ul>
</div>
<div id="subpm" class="submenu">
<ul>
<li><a href="space.php?do=pm">查看未读</a></li>
<li><a href="space.php?do=pm&view=inbox">收件箱</a></li>
<li><a href="space.php?do=pm&view=outbox">发件箱</a></li>
<li><a href="space.php?do=notice">通知</a></li>
<li class="line"><a href="cp.php?ac=pm">发送私信</a></li>
</ul>
</div>
</div>
<div id="content" class="s_clear">
<div id="side">
<?php if($_SGLOBAL['supe_uid']) { ?>
<ul id="app" class="app_list">
<li class="app-doing"><a href="space.php?do=doing">迷你博客</a></li>
<li class="app-blog"><a href="space.php?do=blog">日志</a><em><a href="cp.php?ac=blog">发表</a></em></li>
<li class="app-photo"><a href="space.php?do=album">相册</a><em><a href="cp.php?ac=upload">上传</a></em></li>
<li class="app-mtag"><a href="space.php?do=thread">话题</a><em><a href="cp.php?ac=thread">发起</a></em></li>
<li class="app-share"><a href="space.php?do=share">分享</a></li>

<?php if(is_array($_SGLOBAL['app'])) { foreach($_SGLOBAL['app'] as $key => $value) { ?>
<?php if($key != UC_APPID && $value['open']) { ?>
<li class="app-<?=$value['type']?>"><a href="space.php?do=app&appid=<?=$key?>" title="<?=$value['name']?>"><?=$value['name']?></a></li>
<?php } ?>
<?php } } ?>
</ul>
<?php } else { ?>
<?php if(empty($space['theme']) && empty($space['css'])) { ?>
<?php if(empty($_SGLOBAL['nologinform'])) { ?>
<form id="loginform" name="loginform" action="do.php?ac=login&ref" method="post">
<div style="padding: 10px;">
<p class="gray"><label for="username">用户名：</label></p>
<p><input type="text" name="username" id="username" class="t_input" value="<?=$membername?>" size="15" style="width: 100px;" /></p>
<p class="gray"><label for="password">密　码：</label></p>
<p><input type="password" name="password" id="password" class="t_input" size="15" style="width: 100px;" /></p>
<p><input type="checkbox" id="cookietime" name="cookietime" value="315360000" checked /> <label for="cookietime">下次自动登录</label></p>
<p style="padding-top: 4px;">
<input type="hidden" name="refer" value="space.php?do=home" />
<input type="submit" id="loginsubmit" name="loginsubmit" value="登录" class="submit" style="padding: 0; width: 50px;" />
<a href="do.php?ac=lostpasswd">找回密码</a>
</p>
</div>
</form>
<?php } ?>
<ul class="sidelink">
<li><a href="do.php?ac=register"><strong>注册</strong>期待您的入住</a></li>
<li><a href="help.php"><strong>页面介绍</strong>了解一下您的家</a></li>
<?php if($_SCONFIG['networkpublic']) { ?><li><a href="network.php"><strong>随便看看</strong>看看大家在做什么</a></li><?php } ?>
</ul>
<?php } ?>
<?php } ?>

<?php if(empty($space['theme']) && empty($space['css'])) { ?>
<?php adshow('leftside'); ?><!-- 左侧栏广告-->
<?php } ?>
</div>
<div id="mainarea">
<?php } else { ?>
<?php obclean();
	@header("Expires: -1");
	@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
	@header("Pragma: no-cache");
	@header("Content-type: application/xml; charset=$_SC[charset]");
	echo '<'."?xml version=\"1.0\" encoding=\"$_SC[charset]\"?>\n";
	echo "<root><![CDATA["; ?>
<?php } ?>

<?php if($_GET['op']=='edit') { ?>

<form method="post" action="cp.php?ac=mtag&op=edit&tagid=<?=$mtag['tagid']?>">
<?php if($_SGLOBAL['inajax']) { ?>
<h1>设置选吧</h1>
<a href="javascript:hideMenu();" class="float_del" title="关闭">关闭</a>
<div class="popupmenu_inner">
<?php } ?>
<table>
<tr>
<td colspan="2"><strong><?=$mtag['tagname']?></strong></td>
</tr>
<tr>
<th><label for="pic">封面图片：</label></th>
<td><input id="pic" type="text" name="pic" value="<?=$mtag['pic']?>" size="30" /><br />http:// 开头的图片地址</td>
</tr>
<tr>
<th><label for="announcement">公告：</label></th>
<td><textarea id="announcement" name="announcement" cols="40" rows="5"><?=$mtag['announcement']?></textarea></td>
</tr>
<?php if($mtag['isadmin']) { ?>
<tr>
<th>吧主：</th>
<td>
<?php if($moderator['0']) { ?>
<input type="text" name="moderator[0]" value="<?=$moderator['0']?>" size="10" readonly="true">
<?php } else { ?>
<input type="text" name="moderator[0]" value="<?=$moderator['0']?>" size="10">
<?php } ?>
<input type="text" name="moderator[1]" value="<?=$moderator['1']?>" size="10">
<input type="text" name="moderator[2]" value="<?=$moderator['2']?>" size="10">
<input type="text" name="moderator[3]" value="<?=$moderator['3']?>" size="10">
<input type="text" name="moderator[4]" value="<?=$moderator['4']?>" size="10"><br>
<input type="text" name="moderator[5]" value="<?=$moderator['5']?>" size="10">
<input type="text" name="moderator[6]" value="<?=$moderator['6']?>" size="10">
<input type="text" name="moderator[7]" value="<?=$moderator['7']?>" size="10">
<input type="text" name="moderator[8]" value="<?=$moderator['8']?>" size="10">
<input type="text" name="moderator[9]" value="<?=$moderator['9']?>" size="10"><br>
只能从成员列表中选，最多10个，第1位为主版主，不能被更改
</td>
</tr>
<?php } ?>
<tr>
<th>&nbsp;</th>
<td>
<input type="hidden" name="refer" value="<?=$_SGLOBAL['refer']?>" />
<input type="hidden" name="editsubmit" value="true" />
<input type="submit" name="btnsubmit" value="提交编辑" class="submit" />&nbsp;
</td>
</tr>
</table>
</form>

<?php } elseif($_GET['op']=='join') { ?>

<div id="<?=$mtag['tagid']?>" <?php if(!$_SGLOBAL['inajax']) { ?>class="inpage"<?php } ?>>
<form id="joinform" name="joinform" method="post" action="cp.php?ac=mtag&op=join&tagid=<?=$mtag['tagid']?>">
<h1>确定加入该选吧吗？</h1>
<p class="btn_line">
<input type="hidden" name="refer" value="<?=$_SGLOBAL['refer']?>" />
<?php if($_SGLOBAL['inajax']) { ?>
<input type="hidden" name="joinsubmit" value="true" />
<input type="button" name="joinsubmit_btn" value="加入" class="submit" onclick="ajaxpost('joinform', '<?=$mtag['tagid']?>', 'mtag_join')" />&nbsp;
<button name="btncancel" type="button" class="button" onclick="hideMenu()">取消</button>
<?php } else { ?>
<input type="submit" name="joinsubmit" value="加入" class="submit" />
<?php } ?>
</p>
</form>
</div>
<?php } elseif($_GET['op']=='out') { ?>
<div id="<?=$mtag['tagid']?>" <?php if(!$_SGLOBAL['inajax']) { ?>class="inpage"<?php } ?>>
<form id="outform" name="outform" method="post" action="cp.php?ac=mtag&op=out&tagid=<?=$mtag['tagid']?>">
<h1>确定要退出该选吧吗？</h1>
<p class="btn_line">
<input type="hidden" name="refer" value="<?=$_SGLOBAL['refer']?>" />
<?php if($_SGLOBAL['inajax']) { ?>
<input type="hidden" name="outsubmit" value="true" />
<input type="button" name="outsubmit_btn" value="退出" class="submit" onclick="ajaxpost('outform', '<?=$mtag['tagid']?>', 'mtag_join')" />&nbsp;
<button name="btncancel" type="button" class="button" onclick="hideMenu()">取消</button>
<?php } else { ?>
<input type="submit" name="outsubmit" value="退出" class="submit" />
<?php } ?>
</p>
</form>
</div>
<?php } else { ?>

<?php if($_SGLOBAL['guidemode']) { ?>
<div class="c_header a_header">
<a href="space.php?uid=<?=$space['uid']?>"><img src="<?php echo avatar($space[uid],small); ?>" alt="<?=$space['username']?>" id="smallavatar" class="avatar" /></a>
<h1><?=$space['username']?></h1>
<a href="space.php?uid=<?=$space['uid']?>" class="spacelink">我的空间</a>
</div>

<div class="h_status">
欢迎您，<?=$space['username']?>，恭喜入住自己的家，请先根据向导完成以下安家步骤吧。
</div>

<div class="c_header">
<ul class="tabs">
<li<?=$actives['1']?>><a>第一步：头像和资料</a></li>
<li<?=$actives['2']?>><a>第二步：我的选吧</a></li>
<li<?=$actives['find']?>><a>第三步：寻找好友</a></li>
</ul>
</div>
<?php } else { ?>
<div class="c_header">
<ul class="tabs">
<li<?=$actives['profile']?>><a href="cp.php?ac=profile">个人资料</a></li>
<li<?=$actives['mtag']?>><a href="cp.php?ac=mtag">我的选吧</a></li>
<li<?=$actives['space']?>><a href="cp.php?ac=space">空间属性</a></li>
<li<?=$actives['theme']?>><a href="cp.php?ac=theme">主页风格</a></li>
<li<?=$actives['advance']?>><a href="cp.php?ac=advance">高级管理</a></li>
</ul>
</div>
<?php } ?>

<form method="post" action="cp.php?ac=mtag&op=" class="c_form" onsubmit="closeMsg();">
<table cellspacing="0" cellpadding="0" class="formtable" width="100%">
<caption style="padding-bottom: 0; width: 100%;">
<h2>我的选吧</h2>
<p>选吧，就是自己选择的志同道合的交流圈。<br />在吧内，不仅可以结识与你有相同选择的朋友，更可以一起交流话题。</p>
</caption>
</table>
<?php $divjs = ''; ?>
<?php if(is_array($fields)) { foreach($fields as $fieldid => $fvalue) { ?>
<table cellspacing="0" cellpadding="0" class="formtable">
<caption style="padding-bottom: 0;">
<h2><?=$fvalue['title']?></h2>
<?php if($fvalue['note']) { ?><p><?=$fvalue['note']?></p><?php } ?>
</caption>
<tr>
<?php if(is_array($fvalue['formhtml'])) { ?>
<td style="width: 224px; vertical-align: top;">	
<ul id="mtag_<?=$fieldid?>_ul" class="post_list line_list" style="margin-bottom: 8px;">
<?php if($fvalue['formhtml']) { ?>
<?php if(is_array($fvalue['formhtml'])) { foreach($fvalue['formhtml'] as $rowid => $rowvalue) { ?>
<li><?=$rowvalue?></li>
<?php } } ?>
<?php } else { ?>
<li class="gray">请在右侧选择或添加选吧 &raquo;</li>
<?php } ?>
</ul>
<?php if(!$_SGLOBAL['guidemode']) { ?>
<button type="button" class="submit" onclick="document.getElementById('mtagsubmit').click();">保存</button>
<?php } ?>
</td>
<td style="padding-right: 0; padding-top: 0; vertical-align: top;">
<div style="float: right; padding: 8px; background: #F9F9F9;">
<?php if($hotlist[$fieldid]) { ?>
<p style="padding: 4px 0;" class="gray">加入现有的选吧：</p>
<select name="hot_mtag_<?=$fieldid?>" onchange="mtagAdd('<?=$fieldid?>', '<?=$fvalue['inputnum']?>', this.value);">
<option value="">--- 成员数排行 ---</option>
<?php if(is_array($hotlist[$fieldid])) { foreach($hotlist[$fieldid] as $hotvalue) { ?>
<option value="<?=$hotvalue['tagname']?>"><?=$hotvalue['tagname']?> (<?=$hotvalue['membernum']?>人)</option>
<?php } } ?>
</select>					
<?php } ?>
<p style="padding: 4px 0;" class="gray">创建新的选吧：</p>
<table cellspacing="0" cellpadding="0">
<tr>
<td style="padding: 0;"><input type="text" name="mtag_<?=$fieldid?>_name" id="mtag_<?=$fieldid?>_name" value="" class="t_input" style="width: 160px; border-right: none;" /></td>
<td style="padding: 0;"><a href="javascript:;" onclick="mtagSearch('<?=$fieldid?>', '<?=$fvalue['inputnum']?>');"><img src="image/search_btn.gif" alt="搜索" title="从现有的选吧中搜索"/></a></td>
<td style="padding: 0 0 0 3px;"><input class="button" type="button" value="添加" onclick="mtagAdd('<?=$fieldid?>', '<?=$fvalue['inputnum']?>');" /></td>
</tr>
</table>
<div id="mtagresult_<?=$fieldid?>" class="ajax_selector" style="display: none;">
<div class="ajax_selector_option" style="width: 181px;height: 166px;">
<ul id="mtagresult_<?=$fieldid?>_ul" class="blocklink"></ul>
</div>
</div>
<p id="mtagstatus_<?=$fieldid?>" style="padding: 4px 0;"></p>
</div>
</td>
<?php } else { ?>
<td>
<div id="mtagresult_<?=$fieldid?>"></div>
<?=$fvalue['formhtml']?>
<?php if(!$_SGLOBAL['guidemode']) { ?>
&nbsp; <button type="button" class="submit" onclick="document.getElementById('mtagsubmit').click();">保存</button>
<?php } ?>
</td>
<?php } ?>
</tr>
</table>
<?php } } ?>
<br>
<?php if($_SGLOBAL['guidemode']) { ?>
<table cellspacing="0" cellpadding="0" class="formtable">
<tr>
<td><a href="space.php?do=home&view=guide&step=1">返回</a></td>
<td align="center">
<input type="hidden" name="guidemode" value="1">
<input type="submit" id="mtagsubmit" name="mtagsubmit" value="下一步" class="submit" />
 </td>
 <td align="right"><a href="space.php?do=home&view=guide&step=3">跳过&gt;&gt;</a></td>
 </tr>
</table>
<?php } else { ?>
<div style="display: none;"><input type="submit" id="mtagsubmit" name="mtagsubmit" value="提交保存"></div>
<?php } ?>
</form>

<div class="f_status s_clear">
<a href="javascript:;" onclick="window.scrollTo(0,0);" id="a_top" title="TOP">TOP</a>
</div>

<script type="text/javascript">
var isModify = false;
var thetimer = '';
function mtagAdd(id, inputnum, selectname) {
var str = '';
objmtag = $('mtag_'+id+'_name');

if(selectname) {
var mtagname = selectname;
} else {
var mtagname = objmtag.value;
}
var objstatus = $('mtagstatus_'+id);

//mtagname = mtagname.replace(/[ 　]/g, '');
if(strLen(mtagname) >= 40 || strLen(mtagname) <= 0) {
shadowShow(objstatus, '选项请保证在1-40个字符之间');
} else {
var arrayelement = getElementsByName_iefix('input', 'mtag['+id+'][]');
var badd = true;
window.onbeforeunload = showUnload;
isModify = true;
if(arrayelement.length < inputnum) {
for(i = 0; i < arrayelement.length; i++) {
if(arrayelement[i].value == mtagname) {
badd = false; 
break;
}
}
if(badd) {
var mtagname = cnCode(mtagname);
var x = new Ajax();
x.get('cp.php?ac=mtag&op=searchmtag&inajax=1&fieldid='+id+'&mtagname='+mtagname, function(s){
var newli = document.createElement("li");
newli.innerHTML = s;
$('mtag_'+id+'_ul').appendChild(newli);

objstatus.innerHTML = '';
objmtag.value = '';
});
} else {
shadowShow(objstatus, '选项已经存在');
}
} else {
shadowShow(objstatus, '最多支持 '+inputnum+' 个');
}
}
objmtag.focus();
}
function mtagSearch(id, inputnum) {
var str = '';
var objmtag = $('mtag_'+id+'_name');
var objstatus = $('mtagstatus_'+id);
closeMsg();
objmtag.value = objmtag.value.replace(/[ 　]/g, '');
if(strLen(objmtag.value) >= 40 || strLen(objmtag.value) <= 2) {
shadowShow(objstatus, '选项请保证在3-39个字符之间');
} else {
var mtagname = cnCode(objmtag.value);
var x = new Ajax();
x.get('cp.php?ac=mtag&op=searchmtag&inajax=1&fieldid='+id+'&mtagname='+mtagname+'&like=1&inputnum='+inputnum, function(s){
if(s != '') {
$('mtagresult_'+id).style.display = '';
$('mtagresult_'+id+'_ul').innerHTML = s;
objstatus.innerHTML = '';
} else {
shadowShow(objstatus, '查询不到结果');
}
if(isModify) window.onbeforeunload = showUnload;
});
}
objmtag.focus();
}
function mtagDel(obj) {
obj.parentNode.parentNode.removeChild(obj.parentNode);
window.onbeforeunload = showUnload;
isModify = true;
}
function mtagChoose(id, str) {
$('mtag_'+id+'_name').value = str;
$('mtagresult_'+id).style.display = 'none';

}
function postsearchmtag(event, id, inputnum) {
if(event.keyCode == 13) {
mtagAdd(id, inputnum);
return false;
}
}
function getElementsByName_iefix(tag, name) { 
var elem = document.getElementsByTagName(tag); 
var arr = new Array(); 
for(i = 0, iarr = 0; i < elem.length; i++) { 
att = elem[i].getAttribute("name"); 
if(att == name) { 
arr[iarr] = elem[i]; 
iarr++; 
} 
} 
return arr; 
}
function strLen(str) {
var charset = document.charset; 
var len = 0;
for(var i = 0; i < str.length; i++) {
len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? (charset == "utf-8" ? 3 : 2) : 1;
}
return len;
}
function shadowShow(obj, str) {
obj.innerHTML = str;
setTimeout(function(){obj.innerHTML=''}, 3000);
}
function showUnload() {
return '选吧还没有提交保存!';
}
function closeMsg() {
window.onbeforeunload = null;
return true;
}
</script>
<?php } ?>
<?php if(empty($_SGLOBAL['inajax'])) { ?>
</div>
</div>

<div id="footer">
<p class="copyright" title="<?php echo debuginfo(); ?>">
<?=$_SCONFIG['sitename']?> &nbsp; <a href="mailto:<?=$_SCONFIG['adminemail']?>">联系我们</a>
<?php if($_SCONFIG['miibeian']) { ?> &nbsp;<a  href="http://www.miibeian.gov.cn" target="_blank"><?=$_SCONFIG['miibeian']?></a><?php } ?>
 &nbsp; Powered by <a  href="http://u.discuz.net" target="_blank">UCenter Home</a> <span title="<?php echo X_RELEASE; ?>"><?php echo X_VER; ?></span>
 <?php if(!empty($_SCONFIG['licensed'])) { ?><a  href="http://license.comsenz.com/?pid=7&host=<?=$_SERVER['HTTP_HOST']?>" target="_blank">Licensed</a><?php } ?>
 &copy; 2001-2008 <a  href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>
</p>
</div>
</div>
<script language="javascript" type="text/javascript" src="source/script_manage.js"></script>
<?php adshow('footer'); ?><!-- 页脚广告-->

<?php if($_SGLOBAL['supe_uid']) { ?>
<?php if(!isset($_SCOOKIE['checkpm'])) { ?>
<script type="text/javascript" src="cp.php?ac=pm&op=checknewpm&rand=<?php echo rand(0,999) ?>"></script>
<?php } ?>
<?php if(!isset($_SCOOKIE['synfriend'])) { ?>
<script type="text/javascript" src="cp.php?ac=friend&op=syn&rand=<?php echo rand(0,999) ?>"></script>
<?php } ?>
<?php } ?>
</body>
</html>
<?php } ?>
<?php ob_out(); ?><?php subtplcheck('template/default/cp_mtag|template/default/header|template/default/space_guide|template/default/cp_header|template/default/footer', '1229241147', 'template/default/cp_mtag'); ?>